package configuration.dataObjects
{
	import mx.collections.ArrayCollection;
	[Bindable]
	public class ItemBarcodeDO
	{
		public var INTERNAL_ITEM_BARCODE_NUM:String = "0";
		public var ITEM:String = "";
		public var COMPANY:String = "";
		public var BARCODE:String = "0";
		public var QUANTITY_UM:String = "";
		public var ACTIVE:String = "Y";
		
		public function ItemBarcodeDO()
		{
		}

		public function Init(xmlObj:XML):void{
			if(null == xmlObj)
				return;
			else{
				for each (var itemProp:XML in xmlObj.children()) {			
					this[itemProp.name()] = itemProp;
				}
			}
		}
		
		public function ToXML():XML{
			var xmlObj:XML =
			<ITEM_BARCODE>
				<INTERNAL_ITEM_BARCODE_NUM>{INTERNAL_ITEM_BARCODE_NUM}</INTERNAL_ITEM_BARCODE_NUM>
				<ITEM>{ITEM}</ITEM>
				<COMPANY>{COMPANY}</COMPANY>
				<BARCODE>{BARCODE}</BARCODE>
				<QUANTITY_UM>{QUANTITY_UM}</QUANTITY_UM>
				<ACTIVE>{ACTIVE}</ACTIVE>			
			</ITEM_BARCODE>;
			return xmlObj;
		}
		
		public static function getItems(list:XMLList):ArrayCollection
		{
			var ac:ArrayCollection = new ArrayCollection();
			for each(var xml:XML in list)
			{
				var itm:ItemBarcodeDO = new ItemBarcodeDO();
				itm.Init(xml);
				ac.addItem(itm);
			}
			return ac;
		}

	}
}